﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Csla.Xaml;
using HeThongThongTin.Library;
using System.Windows.Data;
using BusinessConfiguration;

namespace HeThongThongTin.UI.SL.HeThong.HT_VaiTro
{
    public class HT_VaiTro_ListViewModel : ViewModel<HT_VaiTroList>
    {
        public HT_VaiTro_ListViewModel(string mode)
        {
            BeginRefresh("GetHT_VaiTroList", mode);
          
        }

        public void GetHT_VaiTro_ListViewModel(string mode)
        {
            BeginRefresh("GetHT_VaiTroList", mode);
        }

        public static readonly DependencyProperty SelectedItemProperty =
          DependencyProperty.Register("SelectedItem", typeof(HT_VaiTroInfo), typeof(HT_VaiTro_ListViewModel), null);
        public HT_VaiTroInfo SelectedItem
        {
            get { return (HT_VaiTroInfo)GetValue(SelectedItemProperty); }
            set { SetValue(SelectedItemProperty, value); }
        }

        public void DeleteHT_VaiTro(object sender, ExecuteEventArgs e)
        {
            if (e.MethodParameter != null)
            {
                //cast parameter
                string parameter = e.MethodParameter.ToString();
                this.IsBusy = true;
                HeThongThongTin.Library.HT_VaiTro.DeleteHT_VaiTro(int.Parse(parameter), (o, ex) =>
                {
                    BeginRefresh("GetHT_VaiTroList", BusinessConfiguration.Configuration.GridViewFetchMode);
                });
                this.IsBusy = false;
            }
        }
    }
}

 
			
        
 
				
        	